#{extends 'CRUD/layout.html' /}
#{set title:messages.get('objects.medications') /}

<div id="crudList" class="${type.name}">

    <h2 id="crudListTitle">&{'objects.medications'}</h2>

    <div id="crudListSearch">
        #{crud.search /}
    </div>

    <div id="crudListTable">
        #{crud.table fields:['medicationName', 'treatmentType']}
        	#{crud.custom 'medicationName'}
           	  	<span class="hiddenLinks">@{Medications.show(object.medicationId)}</span>
		      	${object.medicationName}
		   	#{/crud.custom}
			#{crud.custom 'treatmentType'}
           	  	<span class="hiddenLinks">@{TreatmentTypes.show(object.treatmentType.treatmentTypeId)}</span>
		      	${object.treatmentType}
		   	#{/crud.custom}
        #{/crud.table}
    </div>

    <div id="crudListPagination">
        &{'total', models.Medication.count()}
        #{pagination /}
    </div>

    <p id="crudListAdd">
        <a href="@{blank()}">&{'medication.add'}</a>
    </p>

</div>
